package com.wx.mythread.uncaughtexception;

public class UseOnUncaughtExceptionHandle implements Runnable {

    public static void main(String[] args) throws InterruptedException {
        Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHanlder("捕获器1"));
        new Thread(new UseOnUncaughtExceptionHandle(), "MyThread-1").start();
        Thread.sleep(300);
        new Thread(new UseOnUncaughtExceptionHandle(), "MyThread-2").start();
        Thread.sleep(300);
        new Thread(new UseOnUncaughtExceptionHandle(), "MyThread-3").start();
        Thread.sleep(300);
        new Thread(new UseOnUncaughtExceptionHandle(), "MyThread-4").start();
        Thread.sleep(300);
    }

    @Override
    public void run() {
        throw new RuntimeException();
    }
}
